# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        
        # Adding model 'Client'
        db.create_table('washing_client', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('fio', self.gf('django.db.models.fields.CharField')(max_length=250)),
            ('auto_number', self.gf('django.db.models.fields.CharField')(max_length=6)),
            ('auto_region', self.gf('django.db.models.fields.IntegerField')()),
            ('phone', self.gf('django.db.models.fields.CharField')(max_length=25)),
        ))
        db.send_create_signal('washing', ['Client'])

        # Adding model 'Journal'
        db.create_table('washing_journal', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('datatime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2012, 3, 6, 14, 46, 25, 658000))),
            ('client', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['washing.Client'])),
            ('autotype', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['washing.AutoType'])),
        ))
        db.send_create_signal('washing', ['Journal'])

        # Adding M2M table for field service on 'Journal'
        db.create_table('washing_journal_service', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('journal', models.ForeignKey(orm['washing.journal'], null=False)),
            ('service', models.ForeignKey(orm['washing.service'], null=False))
        ))
        db.create_unique('washing_journal_service', ['journal_id', 'service_id'])


    def backwards(self, orm):
        
        # Deleting model 'Client'
        db.delete_table('washing_client')

        # Deleting model 'Journal'
        db.delete_table('washing_journal')

        # Removing M2M table for field service on 'Journal'
        db.delete_table('washing_journal_service')


    models = {
        'washing.autotype': {
            'Meta': {'object_name': 'AutoType'},
            'description': ('django.db.models.fields.TextField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '250'})
        },
        'washing.client': {
            'Meta': {'object_name': 'Client'},
            'auto_number': ('django.db.models.fields.CharField', [], {'max_length': '6'}),
            'auto_region': ('django.db.models.fields.IntegerField', [], {}),
            'fio': ('django.db.models.fields.CharField', [], {'max_length': '250'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'phone': ('django.db.models.fields.CharField', [], {'max_length': '25'})
        },
        'washing.journal': {
            'Meta': {'object_name': 'Journal'},
            'autotype': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['washing.AutoType']"}),
            'client': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['washing.Client']"}),
            'datatime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 3, 6, 14, 46, 25, 658000)'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'service': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['washing.Service']", 'symmetrical': 'False'})
        },
        'washing.price': {
            'Meta': {'object_name': 'Price'},
            'autotype': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['washing.AutoType']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'service': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['washing.Service']"}),
            'sum': ('django.db.models.fields.FloatField', [], {})
        },
        'washing.service': {
            'Meta': {'object_name': 'Service'},
            'description': ('django.db.models.fields.TextField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '250'})
        }
    }

    complete_apps = ['washing']
